﻿using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace ExcellentCRM.DataService.Models
{
    /// <summary>
    /// 菜单
    /// </summary>
    public class Menu : BaseModel
    {
        [Required(AllowEmptyStrings = false)]
        [StringLength(15)]
        public string MenuName { get; set; }

        [StringLength(1000)]
        public string MenuUrl { get; set; }

        /// <summary>
        /// 控制器名
        /// </summary>
        [StringLength(50)]
        public string CtlName { get; set; }

        /// <summary>
        /// Action名
        /// </summary>
        [StringLength(50)]
        public string ActName { get; set; }

        public MenuType MenuType { get; set; }

        public long? ParentId { get; set; }

        [ForeignKey("ParentId")]
        public virtual Menu ParentMenu { get; set; }

        public virtual IList<Menu> ChildMenus { get; set; }
    }

    public enum MenuType
    {
        Nav = 0,
        Action = 1
    }
}